#include <iostream>
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <unistd.h>
#define PATH "/home/yyf/linux_code/24.7.14"
#define SIZE 4096
int CreateShm()
{
    int n = shmget(ftok(PATH,1),SIZE,IPC_CREAT | IPC_EXCL);
    if(n == -1)
    {
        std::cerr << "Create Shm error!" << std::endl;
        exit(1);
    }

    return n;
}

int GetShm()
{
    int n = shmget(ftok(PATH,1),SIZE,IPC_CREAT);
    if(n == -1)
    {
        std::cerr << "Create Shm error!" << std::endl;
        exit(1);
    }
    return n;
}